<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<button>开始</button>
	<p>天选之子:</p>
	<script type="text/javascript">
		let data = ['大安','左左','维克','乍见','熊大','熊二','光头强','猪猪侠','超人强','小呆呆']

		let btn = document.querySelector('button')
		let p = document.querySelector('p')

		let time = null
		let num = null

		btn.onclick = function() {
			if(btn.innerText == '开始'){
				btn.innerText = "结束"
				time = setInterval(function(){
					num = parseInt(Math.random() * data.lenght)
					p.innerText = data[num]
				},100)	
			}else{
				btn.innerText = "开始"
				clearInterval(time)
				data.splice(num,1)
				console.log(data.lenght)
			}
		}
	</script>
</body>
</html>